import { http } from "@/utils/http";
import { Result, arrayResult } from "../types";

type data = {
    agvid?: number,
    agvname?: string,
    ip?: string,
    model?: string,
    status?: number,
    vehicletype?: number,
    note?: string
};

type search = {
    stationname: string,
    x: string,
    y: string,
    stationtype: string,
    status: number,
    pageNumber: number,
    pageSize: number,
    sortName: string,
    sortType: number,
    stationName: number
}

type select = {
    stationType?: number,
    status?: number,
    mapid?: number
}

// 站点列表
export const stationList = (params?: search) => {
    return http.request<Result>("get", "/api/station/List", { params });
};

// 新增站点
export const addStation = (data: data) => {
    return http.request<Result>("post", "/api/station/Add", { data });
};

// 详情
export const getStation = (id: number) => {
    return http.request<Result>("get", `/api/station/Get/${id}`);
};

// 修改站点
export const updateStation = (data: data) => {
    return http.request<Result>("post", "/api/station/Update", { data });
};

// 删除站点
export const delStation = (id: number) => {
    return http.request<Result>("post", `/api/station/Delete/${id}`, {});
};

// 站点下拉
export const GetAllStation = (params?: select) => {
    return http.request<arrayResult>("get", "/api/station/GetAllStation", { params });
};

// 站点详情（首页地图）
export const GetAllStationDetail = (params?: any) => {
    return http.request<arrayResult>("get", "/api/station/GetAllStationDetail", { params });
};

// 根据站点名称查询
export const GetByName = (params?: any) => {
    return http.request<arrayResult>("get", "/api/station/GetByName", { params });
};